package com.elead.oa.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elead.oa.entity.Employee;
import com.elead.oa.vo.EmployAttendanceVo;
import com.elead.oa.vo.EmployDepartmentVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * todo:考勤管理数据层
 * EmployeeMapper<br/>
 * 创建人:xiaozuolin<br/>
 * 时间：2021年09月29日 10:06:21 <br/>
 * @version 1.0.0<br/>
 *
 */
@Mapper
public interface EmployeeMapper extends BaseMapper<Employee>{
    @Select("select em.*,at.id,at.in_time,at.out_time from employee em join attendance at where em.id=at.employee_id and em.id=#{id}")
    List<EmployAttendanceVo> getAllAttendanceByEmployId(int id);

    @Select("select em.id, em.name, em.password, em.authority, em.po sition, em.status, em.phone, em.gmt_create, em.gmt_modified,d.depa_name from employee em join department d on em.department_id = d.id")
    List<EmployDepartmentVo> employQuery();

    @Select("select em.id, em.name, em.password, em.authority, em.position, em.status, em.phone, em.gmt_create, em.gmt_modified,d.depa_name from employee em join department d on em.department_id = d.id and em.id = #{id}")
    EmployDepartmentVo getEmployDepartmentVoById(int id);
}